package org.example;

import java.util.concurrent.TimeUnit;

class News{
    private long nid;
    private String title;
    public News(long nid,String title){
        this.nid=nid;
        this.title=title;
    }
    public String toString(){
        return "【新闻数据】新闻编号："+this.nid+",新闻标题："+this.title;
    }
}

public class YootkDemo27 {
    public static void main(String[] args)throws Exception{
        Cache<Long,News> cache=new Cache<Long,News>();
        cache.put(1L,new News(1L,"沐言科技：www.yootk.com"));
        cache.out(2L,new News(2L,"李兴华高薪就业编程训练营：edu.yoootk.com"));
        System.out.println(cache.get(1L));
        System.out.println(cache.get(2L));
        TimeUnit.SECONDS.sleep(5);
        System.out.println("------5秒之后再次读取数据-------");
        System.out.println(cache.get(1L));
    }
}
